﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Domain.MainModule.Entities;
using Domain.Core.Specification;

namespace Domain.MainModule.Orders
{
    public class OrderOrderIdSpecification:Specification<Order>
    {
        Guid _orderId;

        public OrderOrderIdSpecification(Guid orderId)
        {
            this._orderId = orderId;
        }

        public override System.Linq.Expressions.Expression<Func<Order, bool>> SatisfiedBy()
        {
            Specification<Order> spec = new TrueSpecification<Order>();
            spec &= new DirectSpecification<Order>(c => c.OrderId == _orderId);

            return spec.SatisfiedBy();

        }
    }
}
